home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Objects / ScreenObjectList.s < prev   
Text File  |  1997-12-16  |  5KB  |  167 lines

  1. ;-------T-------T------------------------T---------------------------------;
  2. ;Name:      Object List Example
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions © 1996-1997.  Freely distributable.
  5. ;
  6. ;This demo will open a screen, based on the parameters in an external object
  7. ;file.  This allows a VERY high level of external editing that will alter
  8. ;how this program behaves, without having to reassemble it.
  9. ;
  10. ;This feature is highly important as it allows up to 100% configurability of
  11. ;your game, which previously has only been available to applications using
  12. ;libraries such as MUI.  However, it is even more powerful than this as
  13. ;graphic artists could not only create new datasets for your game, but also
  14. ;alter the dimensions, colours, resolution, attributes (and more) of your
  15. ;BOBs and screens.  Support for code segments is also available, so
  16. ;external functions could be altered and improved by programmers.  This will
  17. ;ensure that your game has a long lasting future as it keeps up with current
  18. ;technology and additions to GMS.
  19. ;
  20. ;I hope you make the most of external objects, its worth it!
  21.  
  22.     INCDIR    "GMSDev:Includes/"
  23.     INCLUDE    "dpkernel/dpkernel.i"
  24.     INCLUDE    "files/objects.i"
  25.     INCLUDE    "modules/objects.i"
  26.  
  27.     SECTION    "Demo",CODE
  28.  
  29. ;===========================================================================;
  30. ;                             INITIALISE DEMO
  31. ;===========================================================================;
  32.  
  33.     STARTDPK
  34.  
  35. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  36.     move.l    DPKBase(pc),a6
  37.     lea    OBJFileName(pc),a0    ;a0 = Name of the object file.
  38.     moveq    #ID_OBJECTFILE,d0    ;d0 = ID_OBJECTFILE
  39.     CALL    Load    ;>> = Go and load it.
  40.     move.l    d0,ObjectFile    ;MA = Save the base.
  41.     beq    .Exit    ;>> = Quit if error.
  42.  
  43.     ;Open the objects module.
  44.  
  45.     lea    ObjModTags(pc),a0    ;a0 = Module tags.
  46.     sub.l    a1,a1    ;a1 = No container.
  47.     CALL    Init    ;>> = Initialise Cards Interface.
  48.     tst.l    d0    ;d0 = Check for error.
  49.     beq    .Exit    ;>> = Error, exit.
  50.     move.l    d0,a0    ;a0 = Card module.
  51.     move.l    MOD_ModBase(a0),OBJBase    ;ma = Store jump table.
  52.  
  53.     move.l    OBJBase(pc),a6
  54.     move.l    ObjectFile(pc),a0    ;a0 = Object Base.
  55.     lea    Objects(pc),a1    ;a1 = A list of objects to get.
  56.     CALL    GetFileObjectList    ;>> = Get our objects.
  57.     tst.l    d0    ;d0 = Success?
  58.     bne.s    .Exit    ;>> = Quit if error.
  59.  
  60.     move.l    DPKBase(pc),a6
  61.     move.l    Screen(pc),a0    ;a0 = Screen tags.
  62.     sub.l    a1,a1    ;a1 = No container.
  63.     CALL    Init    ;>> = Initialise the screen.
  64.     tst.l    d0    ;MA = Save pointer to the Screen.
  65.     beq.s    .Exit    ;>> = Quit if error.
  66.  
  67.     move.l    Picture(pc),a0
  68.     move.l    Screen(pc),a1
  69.     move.l    PIC_Bitmap(a0),a2
  70.     move.l    GS_MemPtr1(a1),BMP_Data(a2)
  71.     sub.l    a1,a1
  72.     CALL    Init
  73.     tst.l    d0
  74.     beq.s    .Exit
  75.  
  76.     move.l    SCRBase(pc),a6
  77.     move.l    Screen(pc),a0
  78.     move.l    Picture(pc),a1
  79.     move.l    PIC_Palette(a1),GS_Palette(a0)
  80.     CALL    scrUpdatePalette
  81.  
  82.     move.l    DPKBase(pc),a6
  83.     moveq    #ID_JOYDATA,d0    ;Get joydata structure for reading
  84.     CALL    Get    ;port 0.
  85.     move.l    d0,JoyData
  86.     beq.s    .Exit
  87.     move.l    d0,a0    ;Initialise the joydata structure.
  88.     sub.l    a1,a1
  89.     CALL    Init
  90.     tst.l    d0
  91.     beq.s    .Exit
  92.  
  93.     move.l    Screen(pc),a0
  94.     CALL    Display
  95.  
  96.     bsr.s    Main
  97.  
  98. .Exit    move.l    DPKBase(pc),a6
  99.     move.l    JoyData(pc),a0
  100.     CALL    Free
  101.     move.l    Picture(pc),a0
  102.     CALL    Free
  103.     move.l    Screen(pc),a0
  104.     CALL    Free
  105.     move.l    ObjectFile(pc),a0
  106.     CALL    Free
  107.     move.l    ObjModule(pc),a0
  108.     CALL    Free
  109.     MOVEM.L    (SP)+,A0-A6/D1-D7
  110.     moveq    #ERR_OK,d0
  111.     rts
  112.  
  113. ;===========================================================================;
  114. ;                                MAIN LOOP
  115. ;===========================================================================;
  116.  
  117. Main:    move.l    SCRBase(pc),a6
  118.     CALL    scrWaitAVBL
  119.  
  120.     move.l    DPKBase(pc),a6
  121.     move.l    JoyData(pc),a0
  122.     CALL    Query
  123.     move.l    JoyData(pc),a0
  124.     move.l    JD_Buttons(a0),d0
  125.     btst    #JB_LMB,d0
  126.     beq.s    Main
  127.     rts
  128.  
  129. ;===========================================================================;
  130. ;                                  DATA
  131. ;===========================================================================;
  132.  
  133. JoyData:    dc.l  0
  134. ObjectFile:    dc.l  0
  135. OBJBase:    dc.l  0
  136. OBJFileName:    FILENAME "GMS:demos/data/OBJ.Screen"
  137.  
  138. Objects:    dc.l  OBJECTLIST,0
  139.         dc.l  TXT_Screen
  140. Screen:        dc.l  0
  141.         dc.l  TXT_Picture
  142. Picture:    dc.l  0
  143.         dc.l  LISTEND
  144.  
  145. TXT_Screen:    dc.b  "Screen",0
  146.         even
  147. TXT_Picture:    dc.b  "Picture",0
  148.         even
  149.  
  150. ObjModTags:    dc.l  TAGS_MODULE
  151. ObjModule:    dc.l  0
  152.         dc.l  MODA_Name,ObjName
  153.         dc.l  TAGEND
  154.  
  155. ObjName:    dc.b  "mod.objects",0
  156.         even
  157.  
  158. ;===========================================================================;
  159.  
  160. ProgName:    dc.b  "Object List Demo",0
  161. ProgAuthor:    dc.b  "Paul Manias",0
  162. ProgDate:    dc.b  "10 December 1997",0
  163. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  164. ProgShort:    dc.b  "Object demonstration.",0
  165.         even
  166.  
  167.